package day0803;

import morningClass.Student;
import org.junit.Test;

import java.lang.reflect.Constructor;

public class reflect01 {
    @Test
    public void getCon() throws Exception {
        Class<?> s1 = Student.class;
        Constructor<?> constructor = s1.getConstructor(String.class, int.class);
        Object obj = constructor.newInstance("小李", 18);
        Student student=(Student) obj;
        student.study(10);
        System.out.println(student.name);
        System.out.println(student.age);
    }
}
